CYBERTRON_PATH=${2:-'/home/caros/cybertron'}
source ${CYBERTRON_PATH}/setup.bash
export BCC_PATH=$CYBERTRON_PATH/lib/python/bcc
export LD_LIBRARY_PATH=$BCC_PATH/lib:$LD_LIBRARY_PATH
export PYTHONPATH=$BCC_PATH/lib/python2.7/dist-packages:$PYTHONPATH
export PATH=$BCC_PATH/share/bcc/tools/:$PATH

trace_time=100000

curpid=`ps -ef| grep -E 'mainboard -p compute2d_sched|mainboard -p compute2d_pnc_sched|mainboard -p compute2d_perception_sched' |grep -v 'grep'|awk '{print $2}'`

# echo $curpid
python2 ${CYBERTRON_PATH}/bin/profile.py $trace_time -p ${curpid}  --dir $1 -f -U  --startafter 5 --interval 150 --stack-storage-size 1024000 -F 99 &

# 获取环境变量ENABLE_PROFILE_PER_SECONDS的值
enable_profile=$ENABLE_PROFILE_PER_SECONDS
# 判断值是否为1
if [ "$enable_profile" = "0" ]; then
    sleep 10
    python2 ${CYBERTRON_PATH}/bin/profile_cyber_proc.py --dir $1 &
fi

sleep $trace_time